<template>
  <div class="nihss-contanier">
    <van-tabs v-model:active="active" color="#1a73e8" @change="tabChange" :lazy-render="false">
      <van-tab title="各项得分"><NihssScore @getScore="getScore" ref="refScore" /></van-tab>
      <van-tab title="脑图"><NihssGraph ref="refGraph" @resetScore="resetScore" :scoreList="scoreList" :popupParams="popupParams" /></van-tab>
    </van-tabs>
  </div>
</template>

<script lang="ts" setup>
  import { ref } from 'vue'
  import NihssScore from './NihssScore.vue'
  import NihssGraph from './NihssGraph.vue'

  const active = ref(0)
  let scoreList = ref()
  let popupParams = ref()
  const getScore = (values: any, popup: any) => {
    scoreList.value = values
    popupParams.value = popup
    refGraph.value?.changeTab()
  }

  const refGraph = ref()
  const tabChange = (name: number, title: string) => {
    title === '脑图' ? refGraph.value?.changeTab() : ''
  }
  const refScore = ref()
  const resetScore = () => {
    refScore.value?.resetScore()
  }
</script>
  
<style lang="less" scoped>
  @import './styles/nihss.less';
</style>